Skip to content

Fix formatting checks on pull requests#1592

Open
chelojimenez wants to merge 1 commit intomainfrom
codex/fix-formatting-checks
Open

Fix formatting checks on pull requests#1592
chelojimenez wants to merge 1 commit intomainfrom
codex/fix-formatting-checks

Conversation

@chelojimenez
Copy link
Contributor

Summary

  • add a pull-request formatting job named Check Code Formatting so it matches the required branch-protection context
  • limit auto-formatting commits to direct pushes on main so PR workflows stop pushing a new head SHA that never gets follow-on checks
  • keep the existing auto-fix behavior for main while making PR formatting purely a check

Testing

  • ruby -e "require 'yaml'; data = YAML.load_file('/Users/marcelojimenezrocabado/mcpjam-inspector/.github/workflows/prettier-fix.yml'); puts data['name']; puts data['jobs'].values.map { |job| job['name'] }.join("\n")"

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 12, 2026
@chelojimenez
Copy link
Contributor Author

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 12, 2026

Walkthrough

The workflow file is restructured to separate formatting validation from automatic fixes. A new prettier-check job validates formatting on pull requests, while the existing prettier-fix job applies and commits formatting changes on pushes. The workflow is renamed to "Formatting," permissions are set to read-only at the top level with explicit write permissions for the fix job, and Node.js v24 is configured for both operations.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/prettier-fix.yml:
- Around line 29-33: Add prettier to mcpjam-inspector's devDependencies in
package.json so the CI fix job can run the repo-pinned formatter; update
package.json's "devDependencies" to include "prettier" (matching the version
used by the workflow or desired pinned version) so the existing npm script that
runs "prettier --write ." (invoked by the "npm run prettier-fix" job) succeeds
after npm ci installs packages.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 077f6366-4b92-4fd3-8ba2-c62f63edf532

📥 Commits

Reviewing files that changed from the base of the PR and between f395026 and 6f21763.

📒 Files selected for processing (1)
  • .github/workflows/prettier-fix.yml

Comment on lines +29 to +33
- name: Install dependencies
run: npm ci

- name: Check formatting
run: npx prettier --check .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

pkg="mcpjam-inspector/package.json"

echo "== scripts.prettier-fix =="
jq -r '.scripts["prettier-fix"] // "MISSING"' "$pkg"

echo
echo "== declared prettier dependency =="
jq -r '.devDependencies.prettier // .dependencies.prettier // "MISSING"' "$pkg"

Repository: MCPJam/inspector

Length of output: 149


🏁 Script executed:

cat -n .github/workflows/prettier-fix.yml

Repository: MCPJam/inspector

Length of output: 1942


Add prettier to mcpjam-inspector/package.json devDependencies.

The workflow uses npx prettier in the check job (line 33), which downloads prettier dynamically and works. However, the fix job (line 61) runs npm run prettier-fix, which invokes the script prettier --write .. This will fail because npm ci installed dependencies from an incomplete package.json that doesn't declare prettier. Add prettier as a dev dependency to ensure both jobs use the same repo-pinned formatter version.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/prettier-fix.yml around lines 29 - 33, Add prettier to
mcpjam-inspector's devDependencies in package.json so the CI fix job can run the
repo-pinned formatter; update package.json's "devDependencies" to include
"prettier" (matching the version used by the workflow or desired pinned version)
so the existing npm script that runs "prettier --write ." (invoked by the "npm
run prettier-fix" job) succeeds after npm ci installs packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant